package controller;

import util.JdbcUtils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author gaojie  gao4433@qq.com
 * @Description
 * @date 2022/6/10 3:17
 * @since 1.8
 */
public class GoodsDeleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String goodsId = request.getParameter("goodsId");
        String sql = "DELETE FROM `ec_simple_goods` WHERE `id` = ? ";
        int modify = JdbcUtils.modify(sql, goodsId);
        if (modify==1){
            PrintWriter writer = response.getWriter();
            writer.write("OK");
        }
    }
}